package net.sx.minemodule.mvp.presenters;

import com.kedll.library.mvp.AbstractRefreshPresenter;
import com.kedll.library.mvp.RefreshingView;

import net.sx.minemodule.mvp.bean.TestAnchorCollectBean;

import java.util.Random;

import io.reactivex.Observable;

/**
 * 主播收藏
 * @author 11470
 */
public class MineAnchorCollectPresenter extends AbstractRefreshPresenter<RefreshingView> {

    private Random random;

    public MineAnchorCollectPresenter(RefreshingView mView) {
        super(mView);
        random = new Random();
    }

    @Override
    protected void fetchData(boolean isLoadMore) {
        addSubscription(Observable.range(0, 5)
                .map(integer -> {
                    TestAnchorCollectBean bean = new TestAnchorCollectBean();
                    bean.setName("剃须刀");
                    bean.setHeadPath("https://picsum.photos/300/300/?random" + random.nextInt());
                    return bean;
                })
                .toList()
                .subscribe(bean -> parserData(isLoadMore, bean)));
    }
}
